<template>
	<view class="content">
		<scroll-view scroll-y="true" class="main" @scrolltolower="more">
			<view class="items" :class="{type1:Number(item.money) > 0}" v-for="item in list">
				<view class="item">
					<view class="l l1">
						<text class="label">{{item.memo}}</text>
						<text class="money">{{item.money}}元</text>
					</view>
					<view class="l l2">
						<text>{{item.createtime | date('yyyy.mm.dd hh:MM')}}</text>
						<text>变更后余额{{item.after}}</text>
					</view>
				</view>
			</view>
			<u-empty mode="list" v-if="finish && list.length === 0" style="margin-top: 200rpx;" icon="/static/none.png">
					</u-empty>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type:0,
				page: 1,
				finish: false,
				list: [],
			}
		},
		mounted() {
			this.getList()
		},
		methods: {
			reload() {
				this.page = 1
				this.list = []
				this.finish = false
				this.getList()
			},
			more() {
				this.page++
				this.getList()
			},
			getList() {
				if (this.finish) {
					return
				}
				this.$api.post('/moneylist', {
					page: this.page,
				}).then(res => {
					if (res.code == 1) {
						
						this.list = this.list.concat(res.data)
						
						if (res.data.length === 0) {
							this.finish = true
						}
					}
				}).catch((res) => {
					
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
page{
	background: #F7F7FA;
}
.content{
	height: 100vh;
	display: flex;
	flex-direction: column;
	.main{
		flex: 1;
		overflow: hidden;
	}
}
.tabbar{
	position: relative;
	display: flex;
	width: 750rpx;
	padding-top: 28rpx;
	background-color: #fff;
	box-sizing: border-box;
	.btns{
		width: 340rpx;
		display: flex;
		justify-content: space-between;
		margin: 0 auto;
		font-size: 30rpx;
		font-weight: 600;
		color: #ADB1BF;
		.btn{
			display: flex;
			flex-direction: column;
			align-items: center;
		}
		.act{
			color: #1C274C;
		}
		.act::after{
			content:'';
			width: 22rpx;
			height: 6rpx;
			background: $uni-primary;
			border-radius: 3rpx;
			margin-top: 16rpx;
		}
	}
	
	image{
		width: 16rpx;
		height: 32rpx;
		position: absolute;
		left: 32rpx;
	}
}
.items{
	padding: 32rpx;
	box-sizing: border-box;
	.item{
		width: 686rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		padding: 32rpx;
		box-sizing: border-box;
		.l{
			display: flex;
			align-items: center;
			justify-content: space-between;
		}
		.l1{
			.label{
				font-size: 28rpx;
				font-weight: 600;
				color: #1C274C;
			}
			.money{
				font-size: 32rpx;
				font-weight: 900;
				color: $uni-primary;
			}
		}
		.l2{
			font-size: 22rpx;
			color: #8D93A5;
			margin-top: 10rpx;
		}
	}
}
.type1{
	.money{
		color: $uni-info !important;
	}
}
</style>
